Overview
Reduction and repetition are conceptually quite similar to collection and distribution except they operate temporally rather than spatially. Whereas a collection waits for a number of different events from different input connections, a reduction waits for a number of events from a single input connection (however, unlike collection only one of these is passed on). Likewise, where a distribution copies an event to multiple connected consumers, repetition involves reproducing the same event to the same consumer but multiple times.
How Does CLIP Support Reduction and Repetition?
It is possible to implement reduction and repetition in CLIP using the operators that we have already defined because they are based conceptually on collection and distribution. For example, a reducer can be manufactured using the following collector and splitter configuration:
Similarly, a reducer can be produced from the following distributor and multiplexer configuration:
The example above shows a 'pseudo' repeater object. The repeat count is actually determined by the connection's repeat count. Each connection produces another copy from the distributor, which is then multiplexed. Transparent objects are used to avoid including the repeater in the event tree (see Visibility for more information).
In the case of the reducer, it is very inconvenient to have to create N separate connections between the collector and event provider (where N is the reduction ratio required) and it is also an inefficient implementation and therefore CLIP provides a primitive object that performs this function with much less overhead. The reducer object requires a period and a phase that specify how many events to process after allowing an event through before allowing another event through and the number of events to process from the start before allowing an event through respectively:
The example above shows the S1 data stream distributed to the M1, M2 and M3 methods at three different rates - Period 2, Phase 0 (first event); Period 4, Phase 1 (second event) and Period 4, Phase 3 (forth sample). Thus M1 will see events 0,2,4,6,8,10..., M2 will see events 1,5,9... and M3 will see events 3,7,11... .
The manual repeater implementation using a distributor and multiplexer is much easier to deal with and therefore at present CLIP does not provide a primitive object for this purpose.